#!/usr/bin/env python
import sys
import urllib
import os
#########################################################################                                           #
#                                                                       #
# Copyright (C) 2010 LeXeL                                              #
#                                                                       #
# This program is free software: you can redistribute it and/or modify  #
# it under the terms of the GNU General Public License as published by  #
# the Free Software Foundation, either version 3 of the License, or     #
# any later version.                                                    #
#                                                                       #
# This program is distributed in the hope that it will be useful,       #
# but WITHOUT ANY WARRANTY; without even the implied warranty of        #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
# GNU General Public License for more details.                          #
#                                                                       #
# You should have received a copy of the GNU General Public License     #
# along with this program.  If not, see <http://www.gnu.org/licenses/>. #
#########################################################################

def status(bytes,size_byte,totalbytes):
    totaldownload = bytes * size_byte
    print "Current download is %s from %s " %(totaldownload,totalbytes)
def clear():
    if sys.platform == 'linux-i386' or sys.platform == 'linux2' or sys.platform == 'darwin':
        SysCls = 'clear'
    elif sys.platform == 'win32' or sys.platform == 'dos' or sys.platform[0:5] == 'ms-dos':
        SysCls = 'cls'
    else:
        SysCls = 'unknown'

    return SysCls

def title():
    tit = """
          _  ___                  
         | |/ _ \                   
       __| | | | |__      ___ __    
      / _` | | | |\ \ /\ / / '_ \ 
     | (_| | |_| | \ V  V /| | | |
      \__,_|\___/   \_/\_/ |_| |_|
  
      Made by: lexelEZ[at]gmail[dot]com
          forum.intern0t.net
"""
    print tit

def main():
    os.system(clear())
    title()
    try:
        URL = raw_input("[+] Enter the URL of the file to download: ")
        fil = raw_input("[+] Enter the file name (remeber the prefix): ")
        doit(URL, fil)
    except BaseException,e:
        print "[-] There was an Error!: %s" %(e)
        sys.exit(1)
def doit(a,n):
    try:
        print "[+]The download have Just start!"
        fil = urllib.urlretrieve(a,n,reporthook=status)
    except:
        print "[-]There was an Error In the download!"
        sys.exit()

    print "[+]The current download has Ended!"
if __name__ == '__main__':
    main()
